Polynomial-Time Proactive Synthesis of Tree-to-String Functions from Examples

نویسندگان

  • Mikaël Mayer
  • Jad Hamza
  • Viktor Kuncak
چکیده

Synthesis from examples enables non-expert users to generate programs by specifying examples of their behavior. A domain-specific form of such synthesis has been recently deployed in a widely used spreadsheet software product. In this paper we contribute to foundations of such techniques and present a complete algorithm for synthesis of a class of recursive functions defined by structural recursion over a given algebraic data type definition. The functions we consider map an algebraic data type to a string; they are useful for, e.g., pretty printing and serialization of programs and data. We formalize our problem as learning deterministic sequential top-down tree-to-string transducers with a single state. The first problem we consider is learning a tree-to-string transducer from any set of input/output examples provided by the user. We show that this problem is NP-complete in general, but can be solved in polynomial time under a (practically useful) closure condition that each subtree of a tree in the input/output example set is also part of the input/output examples. Because coming up with relevant input/output examples may be difficult for the user while creating hard constraint problems for the synthesizer, we also study a more automated active learning scenario in which the algorithm chooses the inputs for which the user provides the outputs. Our algorithm asks a worst-case linear number of queries as a function of the size of the algebraic data type definition to determine a unique transducer. To construct our algorithms we present two new results on formal languages. First, we define a class of word equations, called sequential word equations, for which we prove that satisfiability can be solved in deterministic polynomial time. This is in contrast to the general word equations for which the best known complexity upper bound is PSPACE. Second, we close a long-standing open problem about the asymptotic size of test sets for context-free languages. A test set of a language of words L is a subset T of L such that any two word homomorphisms equivalent on T are also equivalent on L. We prove that it is possible to build test sets of cubic size for context-free languages, matching for the first time the lower bound found 20 years ago. Digital Object Identifier 10.4230/LIPIcs...

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Proactive Synthesis of Recursive Tree-to-String Functions from Examples

Synthesis from examples enables non-expert users to generate programs by specifying examples of their behavior. A domain-specific form of such synthesis has been recently deployed in a widely used spreadsheet software product. In this paper we contribute to foundations of such techniques and present a complete algorithm for synthesis of a class of recursive functions defined by structural recur...

متن کامل

Proactive Synthesis of Recursive Tree-to-String Functions from Examples (Artifact)

This artifact, named Prosy, is an interactive command-line tool for synthesizing recursive treeto-string functions (e.g. pretty-printers) from examples. Specifically, Prosy takes as input a Scala file containing a hierarchy of abstract and case classes, and synthesizes the printing function after interacting with the user. Prosy first pro-actively generates a finite set of trees such that their...

متن کامل

Time-Discontinuous Finite Element Analysis of Two-Dimensional Elastodynamic Problems using Complex Fourier Shape Functions

This paper reformulates a time-discontinuous finite element method (TD-FEM) based on a new class of shape functions, called complex Fourier hereafter, for solving two-dimensional elastodynamic problems. These shape functions, which are derived from their corresponding radial basis functions, have some advantages such as the satisfaction of exponential and trigonometric function fields in comple...

متن کامل

Certifying Polynomial Time and Linear/Polynomial Space for Imperative Programs

In earlier work of Kristiansen and Niggl the polynomial-time computable functions were characterised by stack programs of μ-measure 0, and the linear-space computable functions by loop programs of μ-measure 0. Until recently, an open problem was how to extend these characterisations to programs with user-friendly basic instructions, such as assignment statements, and with mixed data structures....

متن کامل

Minimal Synthesis of String To String Functions From Examples

We study the problem of synthesizing string to string transformations from a set of input/output examples. The transformations we consider are expressed using deterministic finite automata (DFA) that read pairs of letters, one letter from the input and one from the output. The DFA corresponding to these transformations have additional constraints, ensuring that each input string is mapped to ex...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • CoRR

دوره abs/1701.04288  شماره 

صفحات  -

تاریخ انتشار 2017